package com.zm.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zm.demo.entry.Paper;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zm
 * @since 2024-08-14
 */
public interface PaperMapper extends BaseMapper<Paper> {
    @Select("select * from paper where id = #{id}")
    @Results(
            id = "rm1",
            value = {
                @Result(column = "id",property = "id",id = true),
                @Result(column = "id",property = "details",
                        many = @Many(select = "com.zm.demo.mapper.PaperDetailMapper.findByPid"))
            }
    )
    public Paper findById(int id);

}
